package com.qhy.service.imp;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.qhy.mapper.TbUserMapper;
import com.qhy.pojo.TbUser;
import com.qhy.pojo.TbUserExample;
import com.qhy.pojo.TbUserExample.Criteria;
import com.qhy.service.IUserService;

@Service
public class UserService implements IUserService {
	
	@Resource
	private TbUserMapper tbUserMapper ;

	public List<TbUser> query(TbUserExample tbExample) {
		return tbUserMapper.selectByExample(tbExample);
	}

	public int deleteById(Integer psId) {
		return tbUserMapper.deleteByPrimaryKey(psId);
	}

	public List<TbUser> queryByRole() {
		TbUserExample example = new TbUserExample();
		Criteria criteria = example.createCriteria();
		criteria.andUsRoleEqualTo(1);
		return tbUserMapper.selectByExample(example);
	}

	public void passRealName(TbUser user) {
		user.setUsRole(2);
		tbUserMapper.updateByPrimaryKeySelective(user);
	}

	public void noPassRealName(TbUser user) {
		user.setUsRole(0);
		tbUserMapper.updateByPrimaryKeySelective(user);
	}

	
	
	
	
	
	
	
	
}
